/*
 * EditProfile.java
 *
 * Created on February 25, 2007, 4:37 PM
 */

package d20chat;


/**
 * Displays a window with the profile of a user displayed.
 * Usually called when a profile is requested from another user.
 */
public class ShowProfile extends javax.swing.JFrame {
    
    //public D20Chat tempMain;
    private String info;
    
    
    /** Creates new form EditProfile */
/**
     * Class constructor of ShowProfile, displays the profile in a small window.
     * @param tinfo profile to be displayed
     */
    public ShowProfile( String tinfo) 
    {
        info = tinfo;
        initComponents();
    }
    
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
/**
     * 
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        lblUsername = new javax.swing.JLabel();
        username = new javax.swing.JTextField();
        lblName = new javax.swing.JLabel();
        name = new javax.swing.JTextField();
        lblEmail = new javax.swing.JLabel();
        email = new javax.swing.JTextField();
        lblPhone = new javax.swing.JLabel();
        phone = new javax.swing.JTextField();
        lblWebsite = new javax.swing.JLabel();
        website = new javax.swing.JTextField();
        lblAboutMe = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        aboutMe = new javax.swing.JTextArea();
        cancel = new javax.swing.JButton();

        setTitle("Profile");
        setLocationByPlatform(true);
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        lblUsername.setForeground(java.awt.Color.darkGray);
        lblUsername.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblUsername.setText("Username:");

        lblName.setForeground(java.awt.Color.darkGray);
        lblName.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblName.setText("Name:");

        lblEmail.setForeground(java.awt.Color.darkGray);
        lblEmail.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblEmail.setText("Email:");

        lblPhone.setForeground(java.awt.Color.darkGray);
        lblPhone.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblPhone.setText("Phone:");

        lblWebsite.setForeground(java.awt.Color.darkGray);
        lblWebsite.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblWebsite.setText("Website:");

        lblAboutMe.setForeground(java.awt.Color.darkGray);
        lblAboutMe.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblAboutMe.setText("About Me:");

        aboutMe.setColumns(20);
        aboutMe.setRows(5);
        jScrollPane1.setViewportView(aboutMe);

        cancel.setText("Close");
        cancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblAboutMe)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lblWebsite)
                            .addComponent(lblPhone)
                            .addComponent(lblEmail)
                            .addComponent(lblUsername)
                            .addComponent(lblName))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(website, javax.swing.GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE)
                                    .addComponent(email, javax.swing.GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE)
                                    .addComponent(phone, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(username, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(name, javax.swing.GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE)))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
                    .addComponent(cancel, javax.swing.GroupLayout.Alignment.TRAILING))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblUsername)
                    .addComponent(username, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(16, 16, 16)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(name, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblName))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(email, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblEmail))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPhone)
                    .addComponent(phone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(website, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblWebsite))
                .addGap(16, 16, 16)
                .addComponent(lblAboutMe)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(cancel)
                .addContainerGap())
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents

    
/********************************************************************************
  Method:
  Description:
  Parameters:
  Used by:
  Uses:
********************************************************************************/
    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        // Set form profile information to possibly already saved info
        User aUser = new User();
        aUser.setUserInfo( info );
        setTitle( aUser.getUsername() + "'s Profile");
        username.setText(aUser.getUsername());
        name.setText(aUser.userProfile.getName());
        email.setText(aUser.userProfile.getEmail());
        phone.setText(aUser.userProfile.getPhone());
        website.setText(aUser.userProfile.getWebsite());
        aboutMe.setText(aUser.userProfile.getAboutMe());
    }//GEN-LAST:event_formWindowOpened

    
/********************************************************************************
  Method:
  Description:
  Parameters:
  Used by:
  Uses:
********************************************************************************/
    private void cancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelActionPerformed
        // Hide form
        this.setVisible(false);
    }//GEN-LAST:event_cancelActionPerformed

    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextArea aboutMe;
    private javax.swing.JButton cancel;
    private javax.swing.JTextField email;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblAboutMe;
    private javax.swing.JLabel lblEmail;
    private javax.swing.JLabel lblName;
    private javax.swing.JLabel lblPhone;
    private javax.swing.JLabel lblUsername;
    private javax.swing.JLabel lblWebsite;
    private javax.swing.JTextField name;
    private javax.swing.JTextField phone;
    private javax.swing.JTextField username;
    private javax.swing.JTextField website;
    // End of variables declaration//GEN-END:variables
    
}
